//
//  AdmissionBottomView.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/18.
//

#import "AdmissionBottomView.h"

@implementation AdmissionBottomView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self CreateUI];
    }
    return self;
}
-(void)CreateUI{

    UIView *backV = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, 550)];
    backV.backgroundColor = [UIColor whiteColor];
    [self addSubview:backV];

    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, 10)];
    line.backgroundColor = rgba(245, 245, 250, 1);
    [backV addSubview:line];


    UIView *pLine = [[UIView alloc]initWithFrame:CGRectMake(15, line.frame.size.height+line.frame.origin.y+15, 3, 15)];
    pLine.backgroundColor = rgba(22, 120, 255, 1);
    pLine.layer.cornerRadius = 2;
    [backV addSubview:pLine];
    UILabel *classCoachPickUpLab = [[UILabel alloc]initWithFrame:CGRectMake(pLine.frame.size.width+pLine.frame.origin.x+5, line.frame.size.height+line.frame.origin.y+15, 70, 15)];
    classCoachPickUpLab.text = @"陪练服务";
    classCoachPickUpLab.textColor = [UIColor blackColor];
    classCoachPickUpLab.textAlignment = 0;
    classCoachPickUpLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backV addSubview:classCoachPickUpLab];

    UIView *backGrayV = [[UIView alloc]initWithFrame:CGRectMake(15, classCoachPickUpLab.frame.size.height+classCoachPickUpLab.frame.origin.y+15, APPwidth-30, 75)];
    backGrayV.backgroundColor = rgba(245, 245, 250, 1);
    backGrayV.layer.cornerRadius = 10;
    [backV addSubview:backGrayV];
    
    UILabel *typeLab = [[UILabel alloc]initWithFrame:CGRectMake(15, 10, backGrayV.frame.size.width-60, 20)];
    typeLab.text = @"科二陪练    自动挡    ￥200/小时";
    typeLab.textColor = [UIColor blackColor];
    typeLab.textAlignment = 0;
    typeLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backGrayV addSubview:typeLab];
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:typeLab.text];
    [str addAttribute:NSForegroundColorAttributeName value:rgba(38, 194, 126, 1) range:NSMakeRange(typeLab.text.length-7, 7)];
    [str addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:16] range:NSMakeRange(typeLab.text.length-7, 7)];
    typeLab.attributedText= str;

    
    UILabel *CoachPickUpLab = [[UILabel alloc]initWithFrame:CGRectMake(15, typeLab.frame.size.height+typeLab.frame.origin.y+15, backGrayV.frame.size.width - 60, 15)];
    CoachPickUpLab.text = @"提供车  1小时  朗逸";
    CoachPickUpLab.textColor = rgba(51, 51, 51, 1);
    CoachPickUpLab.textAlignment = 0;
    CoachPickUpLab.font = [UIFont systemFontOfSize:14];
    [backGrayV addSubview:CoachPickUpLab];
    
    UIButton *weiteBtn = [[UIButton alloc]initWithFrame:CGRectMake(backGrayV.frame.size.width - 80, backGrayV.frame.size.height/2-10, 20, 20)];
    [weiteBtn setImage:[UIImage imageNamed:@""] forState:0];
    weiteBtn.backgroundColor = [UIColor redColor];
    [backGrayV addSubview:weiteBtn];
    
    UIButton *delateBtn = [[UIButton alloc]initWithFrame:CGRectMake(backGrayV.frame.size.width - 40, backGrayV.frame.size.height/2-10, 20, 20)];
    [delateBtn setImage:[UIImage imageNamed:@""] forState:0];
    delateBtn.backgroundColor = [UIColor greenColor];
    [backGrayV addSubview:delateBtn];
    
    
    //教学环境
    UIView *jline1 = [[UIView alloc]initWithFrame:CGRectMake(0, backGrayV.frame.size.height+backGrayV.frame.origin.y+15, APPwidth, 10)];
    jline1.backgroundColor = rgba(245, 245, 250, 1);
    [backV addSubview:jline1];


    UIView *jLine = [[UIView alloc]initWithFrame:CGRectMake(15, jline1.frame.size.height+jline1.frame.origin.y+15, 3, 15)];
    jLine.backgroundColor = rgba(22, 120, 255, 1);
    jLine.layer.cornerRadius = 2;
    [backV addSubview:jLine];
    UILabel *SparringServiceLab = [[UILabel alloc]initWithFrame:CGRectMake(jLine.frame.size.width+jLine.frame.origin.x+5, jline1.frame.size.height+jline1.frame.origin.y+15, 70, 15)];
    SparringServiceLab.text = @"教学环境";
    SparringServiceLab.textColor = [UIColor blackColor];
    SparringServiceLab.textAlignment = 0;
    SparringServiceLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backV addSubview:SparringServiceLab];


    NSArray *AdmissionsServicesImg = @[@"AdSIcon",@"AdSIcon-1",@"AdSIcon-2",@"AdSIcon-3"];
    CGFloat btnW = (APPwidth-50)/4;
    CGFloat btnH = 75;
    for (int i = 0; i < AdmissionsServicesImg.count; i++) {
        NSInteger row = i/4;
        NSInteger col = i%4;
        CGFloat btnX = 10 + (btnW + 10 ) * col;
        CGFloat btnY = 10 + (btnH + 10 ) * row;
        
        _photoImg =[UIButton buttonWithType:UIButtonTypeCustom];
        _photoImg.frame = CGRectMake(btnX,btnY+SparringServiceLab.frame.size.height+SparringServiceLab.frame.origin.y+10, btnW, btnH);
        [_photoImg setTitleColor:[UIColor orangeColor] forState:0];
        _photoImg.layer.cornerRadius = 5;
        _photoImg.layer.borderColor = [UIColor orangeColor].CGColor;
        _photoImg.layer.borderWidth = 1;
        [_photoImg setImage:[UIImage imageNamed:AdmissionsServicesImg[i]] forState:0];
        [backV addSubview:_photoImg];

    }
    
    UIButton *photoBtn = [[UIButton alloc]initWithFrame:CGRectMake(APPwidth-80, jline1.frame.size.height+jline1.frame.origin.y+15, 60, 20)];
    [photoBtn setTitle:@"相册管理" forState:0];
    photoBtn.titleLabel.textAlignment = 2;
    photoBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [photoBtn setTitleColor:[UIColor blueColor] forState:0];
    [backV addSubview:photoBtn];
    

    UIView *bottonline = [[UIView alloc]initWithFrame:CGRectMake(0, _photoImg.frame.size.height+_photoImg.frame.origin.y+15, self.frame.size.width, 10)];
    bottonline.backgroundColor = rgba(245, 245, 250, 1);
    [backV addSubview:bottonline];

    //个人简历
    UIView *mLine = [[UIView alloc]initWithFrame:CGRectMake(15, bottonline.frame.size.height+bottonline.frame.origin.y+15, 3, 15)];
    mLine.backgroundColor = rgba(22, 120, 255, 1);
    mLine.layer.cornerRadius = 2;
    [backV addSubview:mLine];
    UILabel *myResumeLab = [[UILabel alloc]initWithFrame:CGRectMake(mLine.frame.size.width+mLine.frame.origin.x+5, bottonline.frame.size.height+bottonline.frame.origin.y+15, 70, 20)];
    myResumeLab.text = @"个人简历";
    myResumeLab.textColor = [UIColor blackColor];
    myResumeLab.textAlignment = 0;
    myResumeLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backV addSubview:myResumeLab];


    UILabel *myResumeBack = [[UILabel alloc]initWithFrame:CGRectMake(15, mLine.frame.size.height+mLine.frame.origin.y+15, APPwidth-30, 120)];
    myResumeBack.text = @"本人实行人性化教学，为人耿直,热心肠，对学员认真负责，针对学员不同的情况因材施教，通过理论与实践相结合,使学员掌握全面的驾驶知识和驾驶技巧;学车期间包接包送,可根据学员的自由时间安排训练。学员们优异的成绩就是我的追求!";
    myResumeBack.textColor = rgba(138, 138, 138, 1);
    myResumeBack.layer.backgroundColor = rgba(245, 245, 250, 1).CGColor;
    myResumeBack.textAlignment = 0;
    myResumeBack.layer.cornerRadius = 10;
    myResumeBack.numberOfLines = 0;
    myResumeBack.font = [UIFont systemFontOfSize:14];

    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:myResumeBack.text];
       NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
       [paragraphStyle setLineSpacing:5];
       [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [myResumeBack.text length])];
    myResumeBack.attributedText = attributedString;
    
    [backV addSubview:myResumeBack];

}
@end
